package com.mobile.check.present;

import java.util.regex.Pattern;

import com.mobile.check.activitys.BluetoothListActivity;
import com.mobile.check.app.R;

/**
 * 类名: BluetoothPresent
 * 作者: 李学伟
 * 日期: 2020年10月14日 10:45
 * 描述:
 */
public class BluetoothPresent extends BasePresent<BluetoothListActivity> {
    public static final int DEVICE_TYPE_BREDR = 0x01;
    /**
     * CONST: device type bltetooth 4.0 ble
     */
    public static final int DEVICE_TYPE_BLE = 0x02;
    /**
     * CONST: device type bltetooth double mode
     */
    public static final int DEVICE_TYPE_DUMO = 0x03;


    public String toDeviceTypeString(String sDeviceTypeId) {
        Pattern pt = Pattern.compile("^[-\\+]?[\\d]+$");
        if (pt.matcher(sDeviceTypeId).matches()) {
            switch (Integer.valueOf(sDeviceTypeId)) {
                case DEVICE_TYPE_BREDR:
                    return getV().getString(R.string.device_type_bredr);
                case DEVICE_TYPE_BLE:
                    return getV().getString(R.string.device_type_ble);
                case DEVICE_TYPE_DUMO:
                    return getV().getString(R.string.device_type_dumo);
                default: //默认为蓝牙2.0
                    return getV().getString(R.string.device_type_bredr);
            }
        } else
            return sDeviceTypeId; //如果不是数字，则直接输出
    }
}
